Type.registerNamespace("EcmaDoc");

EcmaDoc.Toc = function Toc()
{
}

EcmaDoc.Toc.setup = function Toc$setup()
{
	$evt.addListener($$(".control.plus, .control.minus"), "onclick", EcmaDoc.Toc.onControlClick);
}

EcmaDoc.Toc.onControlClick = function Toc$onControlClick(e)
{
	var parent = $dom.parent(this, ".node");
	var target = $(".children", parent);
	if (target.offsetHeight)
	{
		$css.removeClass(target, "visible");
		$css.replaceClass(this, "minus", "plus");
	}
	else
	{
		$css.addClass(target, "visible");
		$css.replaceClass(this, "plus", "minus");
	}
}

$evt.addListener(window, "onload", EcmaDoc.Toc.setup);
